#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;

void solve()
{
    string s;
    cin >> s;
    string ans;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == '0') {
            ans.push_back('0');
        }
        else if(s[i] == '1') {
            ans.push_back('1');
        }
        else if(s[i] == 'B' && !ans.empty())
        {
            ans.pop_back();
        }
    }
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    while(t--)
    {
        solve();
    }
    return 0;
} 